package com.seirsoft.framework.util;

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

import com.seirsoft.WinAPI;


public class GUIUtil {

	public static GridLayout setGridLayout(Composite composite,
			boolean isMakeColumnsEqualWidth,
			int iNumColumns,
			int iSpacing,
			int iMargin)
	{
		GridLayout layout = new GridLayout();
		layout.makeColumnsEqualWidth = isMakeColumnsEqualWidth;
		layout.marginHeight = iMargin;
		layout.marginWidth = iMargin;
		
		layout.verticalSpacing = iSpacing;
		layout.horizontalSpacing = iSpacing;
		
		layout.numColumns = iNumColumns;

		composite.setLayout(layout);
		return layout;
	}
	
	public static GridLayout setDefaultGridLayout(Composite composite, int iNumColumns)
	{
		return setGridLayout(composite,
				true,
				iNumColumns,
				5,
				0);
	}
	
	public static GridLayout setDefaultGridLayout(
			Composite composite, 
			boolean isMakeColumnsEqualWidth,
			int iNumColumns)
	{
		return setGridLayout(composite,
				isMakeColumnsEqualWidth,
				iNumColumns,
				5,
				0);
	}
	
	public static void playSound(int dwFreq ,int dwDuration)
	{
		WinAPI.Beep(dwFreq, dwDuration);
	}
	
}
